<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>我的订单</title>
    <style>
        body {

            margin: 0;
            padding: 0;
            background: linear-gradient(135deg, #f3f4f6, #e2e8f0);
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        }
        .container {
            max-width: 900px;
            margin: 50px auto;
            background: white;
            border-radius: 20px;
            padding: 30px;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
            animation: fadeInUp 0.6s ease-out forwards;
            opacity: 0;
            transform: translateY(40px);
        }
        @keyframes fadeInUp {
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .order-card {
            margin-bottom: 25px;
            border: 1px solid #eee;
            border-radius: 15px;
            padding: 20px;
            animation: fadeInUp 0.5s ease-out;
        }

        .order-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 10px;
            font-weight: bold;
        }

        .item {
            display: flex;
            align-items: center;
            margin-top: 10px;
        }

        .item img {
            width: 80px;
            border-radius: 8px;
            margin-right: 15px;
        }
        .btn {
            padding: 8px 14px;
            background: linear-gradient(to right, #667eea, #764ba2);
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 14px;
            cursor: pointer;
            margin-top: 10px;
        }
    </style>
</head>
<body>
<div class="container">
    <div style="background: white; padding: 16px 40px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 12px rgba(0,0,0,0.05); border-radius: 0 0 20px 20px;">
        <!-- 左侧导航链接 -->
        <div>
            <a href="${pageContext.request.contextPath}/front/products" style="margin: 0 12px; text-decoration: none; color: #333;">商品浏览</a>
            <a href="${pageContext.request.contextPath}/front/cart" style="margin: 0 12px; text-decoration: none; color: #333;">购物车</a>
            <a href="${pageContext.request.contextPath}/front/order/my" style="margin: 0 12px; text-decoration: none; color: #333;">我的订单</a>
            <a href="${pageContext.request.contextPath}/front/group/my" style="margin: 0 12px; text-decoration: none; color: #333;">我的拼团</a>
        </div>

        <!-- 右侧退出登录 -->
        <div>
            <a href="${pageContext.request.contextPath}/front/login"
               style="padding: 8px 16px; background: linear-gradient(135deg, #c3aed6, #a393eb); color: white; border-radius: 12px; text-decoration: none; transition: all 0.3s ease;">
                退出登录
            </a>

        </div>
    </div>
    <c:forEach var="order" items="${orderList}">
        <div class="order-card">
            <div class="order-header">
                <div>订单编号：${order.order.id}</div>
                <div>状态：${order.order.status}</div>
            </div>
            <div>下单时间：${order.order.createdAt}</div>
            <c:forEach var="item" items="${items}">
                <div class="item">
                    <img src="${item.product.imageUrl}" alt="${item.product.name}" />
                    <div>
                        <div>${item.product.name}</div>
                        <div>单价：￥${item.unitPrice} × 数量：${item.quantity}</div>
                        <div>小计：￥${item.unitPrice * item.quantity}</div>
                    </div>
                </div>
            </c:forEach>
            <div style="text-align:right; margin-top:10px; font-weight:bold;">总计：￥${order.order.totalPrice}</div>
        </div>
    </c:forEach>
</div>
</body>
</html>